package com.dream.keigezhushou.Activity.kege.acty;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import com.dream.keigezhushou.Activity.Uiutils.UiUtils;
import com.dream.keigezhushou.Activity.activity.BaseActivity;
import com.dream.keigezhushou.Activity.acty.ksong.JoinChorusLrcActivity;
import com.dream.keigezhushou.Activity.kege.adapter.ChoralListAdapter;
import com.dream.keigezhushou.R;
import com.handmark.pulltorefresh.library.PullToRefreshBase;
import com.handmark.pulltorefresh.library.PullToRefreshListView;

import butterknife.BindView;
import butterknife.ButterKnife;


/**
 * 参与合唱列表
 */
public class ChoralListActivity extends BaseActivity {


    @BindView(R.id.list_lv)
    PullToRefreshListView pullToRefreshListView;

    private ListView mListView;
    private View heardView;

    private ChoralListAdapter adapter;
    private ImageView returnImg;
    private TextView tvChorus;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_choral_list);
        ButterKnife.bind(this);
        initView();
        initOnClick();
    }


    public void initView() {
        pullToRefreshListView.setMode(PullToRefreshBase.Mode.DISABLED);
        mListView = pullToRefreshListView.getRefreshableView();
        heardView = UiUtils.inflateView(R.layout.heard_choral_list);

        returnImg = (ImageView) heardView.findViewById(R.id.iv_return);
        tvChorus = (TextView)heardView.findViewById(R.id.tv_chorus);
        mListView.addHeaderView(heardView);
        adapter = new ChoralListAdapter(this);
        mListView.setAdapter(adapter);
    }


    public void initOnClick() {
        returnImg.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        tvChorus.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                Intent intent = new Intent(ChoralListActivity.this, JoinChorusLrcActivity.class);
                startActivity(intent);
            }
        });
    }

}
